package com.yunpuvip.sachet.modular.factory;

import cn.hutool.core.util.NumberUtil;

import java.util.Arrays;

public class RandomCodeFactory  {

    public static String getRandom(){

        int[] number = NumberUtil.generateRandomNumber(100000, 999999, 1);
        int[] randomNumber = NumberUtil.generateRandomNumber('a', 'a'+25, 2);
        char f = (char) randomNumber[0];
        char s = (char) randomNumber[1];
        String f1 = Character.toString(f);
        String f2 = Character.toString(s);
        return  f1=f1+f2+number[0];
    }

    /**
     * 包含数字英文的组合
     * @return
     */
    public static String getRandomNumAndEnglish(){
        StringBuilder ranNum = new StringBuilder();
        int[] number = NumberUtil.generateRandomNumber(10, 90, 4);
        for(int num:number){
            if(num>='a'&& num<='z'){
                char f = (char) num;
                ranNum.append((char) num);
            }else {
                ranNum.append(num);
            }
        }
        return  ranNum.toString();
    }

    public static void main(String[] args) {
        System.out.println(getRandom());
    }
}
